package com.sam.im.heiqun.uis.fragments;

import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.sam.im.heiqun.R;

import org.webrtc.RendererCommon;
import org.webrtc.VideoRenderer;
import org.webrtc.VideoRendererGui;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by leijiawen on 2017/7/28.
 */

public class PlayFragment extends Fragment {
    @BindView(R.id.friendVideo)
    GLSurfaceView friendVideo;
    Unbinder unbinder;
    public VideoRenderer.Callbacks remoteRender;
    private int vWidth = 100;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.videocall_pup, container, false);
        unbinder = ButterKnife.bind(this, view);
        VideoRendererGui.setView(friendVideo, new Runnable() {
            @Override
            public void run() {

            }
        });

        remoteRender= VideoRendererGui.createGuiRenderer(0, 0,
                vWidth, vWidth, RendererCommon.ScalingType.SCALE_ASPECT_FILL, true);

        return view;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
